<% label_type = (account.role == "root" ? "success" : "info") %>
<% block_value = (account.blocked ? "unblock" : "block")%>
<% block_class = (account.blocked ? "btn btn-mini" : "btn btn-mini btn-danger")%>

<tr id= account_<%= account.id %>>
    <td><%= link_to account.username, account %></td>
    <td><%= account.email %></td>
    <td><span class="label label-<%= label_type %>"> <%= account.role %> </span></td>
    <% unless account.act_as_root? %>
        <td><%= link_to 'toggle', toggle_admin_account_path(account), :class => "btn btn-mini", :remote => true, :method => 'post' %></td>
        <td> <%= link_to block_value, blocked_account_path(account), :class => block_class, :remote => true, :method => 'post' %></td>
    <% else %>
        <td></td>
        <td></td>
    <% end %>
    <td><%= account.sign_in_count %></td>
    <td><%= account.last_sign_in_ip %></td>
    <td>
        <%= link_to btn_icon(:edit), edit_account_path(account) %>
        <% unless account.act_as_root? %>
            <%= link_to btn_icon(:trash), account, method: :delete, data: { confirm: 'Are you sure?' } %>
        <% end %>
    </td>
</tr>
